package test;

import library.console.ConsoleUtilities;
import org.junit.Test;

import java.util.*;

/**
 * Created by Cheung Chun Hung on 2014/3/21.
 */
public class SystemTestConsoleUtilities {
    @Test
    public void printDate(){
        Calendar date = Calendar.getInstance();
        System.out.printf("%d/%d/%d",date.get(Calendar.YEAR),date.get(Calendar.MONTH)+1,date.get(Calendar.DAY_OF_MONTH));
    }

    @Test
    public void printTableTest(){
        List<List<String>> items = new ArrayList<List<String>>();
        int[] width = {30,30,30};
        String[] cols = {"c1","c2","c3"};
        items.add(Arrays.asList("aaa", "vvv", "ccc"));
        items.add(Arrays.asList("aaa", "vvv", "ccc"));
        ConsoleUtilities.printTable("Testing Table", cols, items, width);
    }

    @Test
    public void printMenuTest(){
        String[] items = {"option1", "option2", "option3"};
        ConsoleUtilities.showMenu(new Scanner("1\n"), "Testing Menu", items);
    }

    @Test
    public void printBox(){
        String message =
                "           |`-.._____..-'|\n" +
                "           :  > .  ,  <  :\n" +
                "           `./ __`' __ \\,'\n" +
                "            | (|_) (|_) |\n" +
                "            ; _  .  __  :\n" +
                "            `.,' - `-. ,'\n" +
                "              `, `_  .'\n" +
                "              /       \\\n" +
                "             /         :\n" +
                "            :          |_\n" +
                "           ,|  .    .  | \\\n" +
                "          : :   \\   |  |  :\n" +
                "          |  \\   :`-;  ;  |\n" +
                "          :   :  | /  /   ;\n" +
                "           :-.'  ;'  / _,'`------.\n" +
                "           `'`''-`'''-'-''--.---  )\n" +
                "                        SSt `----'\n";

        ConsoleUtilities.printBox("Testing", message, 50);
    }
}
